<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class fakultas_model extends CI_model {
    
    function __construct() {
        parent::__construct();
        $this->load->database();
    }
    
    public function insert_fakultas($nama, $singkatan, $alamat, $telp, $fax, $email, $website){
        $data = array(
            'FAKULTAS_NAMA'=>$nama,
            'FAKULTAS_NAMA_SINGKATAN'=>$singkatan,
            'FAKULTAS_ALAMAT'=>$alamat,
            'FAKULTAS_TELP'=>$telp,
            'FAKULTAS_FAX'=>$fax,
            'FAKULTAS_EMAIL'=>$email,
            'FAKULTAS_WEBSITE'=>$website,
        );
         $this->db->insert('fakultas', $data);   
    }
    
    public function edit_fakultas($fakultas_id, $nama, $singkatan, $alamat, $telp, $fax, $email, $website){
        $data = array(
            'FAKULTAS_NAMA'=>$nama,
            'FAKULTAS_NAMA_SINGKATAN'=>$singkatan,
            'FAKULTAS_ALAMAT'=>$alamat,
            'FAKULTAS_TELP'=>$telp,
            'FAKULTAS_FAX'=>$fax,
            'FAKULTAS_EMAIL'=>$email,
            'FAKULTAS_WEBSITE'=>$website,
        );
        $this->db->where('FAKULTAS_ID',$fakultas_id);
        $result = $this->db->update('fakultas', $data);
        return $result; 
    }
    
    public function get_fakultas()
    {
        $query = $this->db->get('FAKULTAS');
        return $query;
    }
    
    public function get_fakultas_byid($fakultas_id)
    {
        $this->db->where('FAKULTAS_ID', $fakultas_id);
        $query = $this->db->get('FAKULTAS');
        return $query;
    }
    
    public function del_fakultas($fakultas_id){
        $this->db->where('FAKULTAS_ID', $fakultas_id);
        $this->db->delete('FAKULTAS');
    }
}